﻿<cfscript>
/** 
* ORM QuestionVote
* 
* @hint "Hibernate persistenter t_vote_response. 学生调查问卷答题情况" 
* 
*/ 

component 
	displayname="public.service.orm.senate.QuestionVote" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="QuestionVote" 
	table="t_vote_response"
	{
	
	property type="string" name="VoteID" column="vote_id" fieldtype="id" generator="assigned" hint="题目回应编号";
	
	property type="string" name="Answer" column="answer" hint="题目回答";

	property name="Student" fieldtype="many-to-one" fkcolumn="stu_id" cfc="Student"  hint="学生";
	property name="QuestionQuota" fieldtype="many-to-one" fkcolumn="quo_id" cfc="QuestionQuota"  hint="题目";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Student "学生"
	* @QuestionQuota "题目"
	*/
	public string function getID( required Student, required QuestionQuota ) output=false {
		
		var nextID = arguments.Student.getStudentID() & "," & arguments.QuestionQuota.getQuotaID();

		/* 
			主键生成规则 
			
			题目回应编号 学号, 11位题目编号

			Unique: STU_ID, QUO_ID
		*/
		return nextID;
	}

}

</cfscript>